const Question = require('../models/question.model');

// 生成questions题目
async function questionGenerateApi(data) {
  const result = await Question.insertMany(data).then( (res) => {
    return res
  });
  return result
}

async function questionDropApi(columnName) {
  const result = await Question.drop(columnName, (err,res) => {
  })
}

async function questionListRandomByCount(count = 20) {
  const result = await Question.aggregate([
    {$sample: { size: count }}
  ])
  return result
}


module.exports = {
  questionGenerateApi,
  questionDropApi,
  questionListRandomByCount
}